<template>
	<view class="content">
		<view class="noData" v-if="orderList.length == 0">--暂无数据--</view>
		<view class="orderList">
			<view class="orderItem" v-for="(item, key) in orderList" @click="orderClick(item.ticketOrderId)">
				<view class="ticketName">
					<view class="name">{{item.ticketName}}</view>
					<view class="status">{{item.payStatus=='1'?item.checkQuantity==item.restCheckQuantity?'未核销':restCheckQuantity>0?'部分核销':'已核销':'退票成功'}}</view>
				</view>
				<view class="timeView">
					<view class="time">
						订单编号：{{item.orderNum}}
					</view>
				</view>
				<view class="timeView">
					<view class="time">
						购买张数：{{item.buyQuantity}}
					</view>
				</view>
				<view class="timeView">
					<view class="time">
						游玩时间：{{item.visitDate}}
					</view>
				</view>
				<view class="timeView">
					<view class="time">
						支付时间：{{item.payTime}}
					</view>
					<view class="price">
						合计
						<view class="priceTxt">￥{{item.totalPrice}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
	
	
</template>

<script>
	export default {
		data() {
			return {
				orderList: []
			}
		},
		onShow() {
			
		},
		onLoad(options) {
			let that = this;
			let ticketGroupNum = options.ticketGroupNum;
			let nowDate = new Date();
			let nowYear = nowDate.getFullYear();
			let nowMonth = nowDate.getMonth()+1;
			nowMonth= nowMonth>9?nowMonth:'0'+nowMonth;
			let nowDay = nowDate.getDate();
			nowDay= nowDay>9?nowDay:'0'+nowDay;
			uni.request({
				url: 'https://boss.smart-ideas.com.cn/ticketApi/order/getDetailListByOpenId',
				method:'GET',
				data: {
					openId: uni.getStorageSync('openId'),
					enterpriseCode: uni.getStorageSync('enterpriseCode'),
					ticketGroupNum: ticketGroupNum,
					rows: 100,
					pages: 1,
					createStartTime: '2023-10-13 00:00:00',
					createEndTime: nowYear + '-' + nowMonth + '-' + nowDay + ' 23:59:59'
				},
				success: (res) => {
					console.log(res);
					let orderList = res.data.queryResult.list;
					that.orderList = orderList;
				}
			})
		},
		methods: {
			orderClick(e){
				console.log(e);
				uni.navigateTo({
					url: '/pages/order/orderDetail?ticketOrderId=' + e
				})
			}
		}
	}
</script>

<style>

	.content{
		box-sizing: border-box;
		min-height: 100vh;
		background-color: #f5f5f5;
		padding: 10px 15px;
		padding-bottom: 64px;
	}
	.orderItem{
		background-color: #fff;
		border-radius: 5px;
		padding: 10px;
		margin-bottom: 10px;
	}
	.orderItem .ticketName{
		border-bottom: 1px solid #f5f5f5;
		display: flex;
		justify-content: start;
		align-items: center;
		padding-bottom: 10px;
	}
	.orderItem .ticketName .name{
		flex: 1;
		font-size: 14px;
		color: #333;
		font-weight: bold;
	}
	.orderItem .ticketName .name font{
		display: inline-block;
		font-size: 12px;
		color: #00b3fd;
		line-height: 23px;
		padding: 0 5px;
		border-radius: 5px;
		margin-left: 10px;
		background-color: #ddf3ff;
	}
	.orderItem .ticketName .status{
		flex: 0 0 60px;
		font-size: 14px;
		text-align: right;
	}
	.orderItem .ticketName .status.black{
		color: #636363;
	}
	.orderItem .ticketName .status.red{
		color: red;
	}
	.orderItem .timeView{
		display: flex;
		justify-content: start;
		align-items: center;
		padding: 5px 0;
	}
	.orderItem .timeView .time{
		flex: 1;
		font-size: 14px;
		color: #636363;
	}
	.orderItem .timeView .price{
		flex: 0 0 80px;
		font-size: 14px;
		color: #636363;
		text-align: right;
		display: flex;
		justify-content: flex-end;
		align-items: center;
	}
	.orderItem .timeView .price .priceTxt{
		font-size: 16px;
		font-weight: bold;
		color: #ff5500;
	}
	.orderItem .refundView{
		display: flex;
		justify-content: flex-end;
		align-items: center;
	}
	.orderItem .refundView a{
		width: 75px;
		line-height: 30px;
		border-radius: 30px;
		font-size: 14px;
		color: #636363;
		border: 1px solid #c4c4c4;
		text-align: center;
	}
	
	.orderItem .deleteView{
		display: flex;
		justify-content: flex-end;
		align-items: flex-end;
		padding: 10px 0 0;
		border-top: 1px solid #f5f5f5;
	}
	
	.orderItem .deleteView a{
		display: block;
		width: 75px;
		line-height: 25px;
		font-size: 12px;
		color: #8D8D8D;
		border: 1px solid #8D8D8D;
		border-radius: 3px;
		text-align: center;
	}
	
	.noData{
		font-size: 14px;
		color: #009F95;
		text-align: center;
		line-height: 50px;
	}
</style>
